package com.petRescueCenter.demo.posting.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.petRescueCenter.demo.user.entity.User;

@Entity
@Table(name = "t_reply")
public class Reply {
	private Long id;
	// 评论的用户
	private User user;
	private String content;
	private Date createTime;
	// 评论的评论
	// private Set<Reply> childReply;
	private Reply parentReply;
	// 回覆帖子的回覆，後面是回覆回覆的回覆
	private Integer readed;
	private Long postingId;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
	public Date getCreateTime() {
		return createTime;
	}

	@ManyToOne
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne
	@JoinColumn(name = "parentId")
	public Reply getParentReply() {
		return parentReply;
	}

	public Integer getReaded() {
		return readed;
	}

	public Long getPostingId() {
		return postingId;
	}

	public void setPostingId(Long postingId) {
		this.postingId = postingId;
	}

	public void setReaded(Integer readed) {
		this.readed = readed;
	}

	public void setParentReply(Reply parentReply) {
		this.parentReply = parentReply;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

}
